const mysql = require("mysql2");

const connectionPool = mysql.createPool({
  host: "localhost",
  port: 3306,
  database: "node_mysql2",
  user: "root",
  password: "root",
  connectionLimit: 5, // 连接池中连接的个数
});

const statement = "select * from `products` where price > ? and score > ?";

connectionPool.execute(statement, [1000, 4], (err, results, fields) => {
  if (err) {
    console.log(err);
    return;
  }
  console.log(results); // 结果
});
